package com.phpxiu.app.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;

import com.phpxiu.app.kkylive.R;
import com.phpxiu.app.view.BaseShare;
import com.phpxiu.app.view.UIHistoryVideoPlayer;

/**
 * 观看回放视频分享菜单
 */
@Deprecated
public class HVShareMenus extends Dialog implements View.OnClickListener{
    private UIHistoryVideoPlayer player;

    public HVShareMenus(Context context) {
        super(context, R.style.shareBoardDialog);
        init(context);
    }

    private final void init(Context context){
        setContentView(R.layout.main_room_share_menus);
        findViewById(R.id.room_share_board_view).setOnClickListener(this);
        findViewById(R.id.share_board_close).setOnClickListener(this);
        findViewById(R.id.share_wx).setOnClickListener(this);
        findViewById(R.id.share_friend).setOnClickListener(this);
        findViewById(R.id.share_wb).setOnClickListener(this);
        findViewById(R.id.share_qq).setOnClickListener(this);
        findViewById(R.id.share_zone).setOnClickListener(this);
        findViewById(R.id.share_fb).setOnClickListener(this);
        findViewById(R.id.share_ins).setOnClickListener(this);
    }

    public void show(UIHistoryVideoPlayer p) {
        player=p;
        super.show();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.share_board_close:
            case R.id.room_share_board_view:
                break;
            case R.id.share_wx:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_WX,player.shareContent);
                }
                break;
            case R.id.share_friend:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_WF,player.shareContent);
                }
                break;
            case R.id.share_wb:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_WB,player.shareContent);
                }
                break;
            case R.id.share_qq:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_QQ,player.shareContent);
                }
                break;
            case R.id.share_zone:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_QZ,player.shareContent);
                }
                break;
            case R.id.share_fb:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_FB,player.shareContent);
                }
                break;

            case R.id.share_ins:
                if(player!=null){
                    player.onRequestShareContentTo(BaseShare.PLATFORM_INS,player.shareContent);
                }
                break;
        }
        dismiss();
    }

    @Override
    public void dismiss() {
        player=null;
        super.dismiss();
    }
}
